/**
 * %%
 * %%
 */
package com.leehom.arch.obs.metrics.exporter;

import java.net.InetAddress;
import java.net.UnknownHostException;

import javax.annotation.PostConstruct;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;

/**
 * @类名: EvnUtils
 * @说明: 
 *
 * @author   leehom
 * @Date	 2021年12月5日 下午12:34:53
 * 修改记录：
 *
 * @see 	 
 */
public class EvnUtils {

	private static String serverPort;
	
	@Autowired
	Environment environment;
	
	@PostConstruct
    public void serverPort(){
        this.serverPort = environment.getProperty("server.port");;
    }
	
    public static String address() {
        InetAddress address = null;
        try {
            address = InetAddress.getLocalHost();
        } catch (UnknownHostException e) {
            
        }
        return address.getHostAddress() + ":" + EvnUtils.serverPort;
    }

}

